package main

import (
	"fmt"
	"strconv"
)

func main() {
	// 字符串中解析对应数据
	str := "10000"
	ret1, err1 := strconv.ParseInt(str, 10, 64)
	if err1 != nil {
		fmt.Println("parseint failed, err: ", err1)
		return
	}
	fmt.Printf("%#v %T\n", ret1, int(ret1)) // 10000 int

	// 字符串中解析布尔值
	boolStr := "true"
	parseBool, _ := strconv.ParseBool(boolStr)
	fmt.Printf("%#v %T\n", boolStr, parseBool) // "true" bool

	// 数字转字符串
	i := 97
	ret2 := string(i)
	fmt.Println(ret2) // a
	ret3 := strconv.Itoa(i)
	fmt.Printf("%#v", ret3) // "97"
}
